package cn.tedu.yl.cost.controller;

import cn.tedu.yl.base.response.JsonResult;
import cn.tedu.yl.cost.pojo.dto.CostQuery;
import cn.tedu.yl.cost.pojo.dto.CostSaveParam;

import cn.tedu.yl.cost.pojo.vo.CostVO;
import cn.tedu.yl.cost.service.CostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/v1/cost")
public class CostController {
    @Autowired
    private CostService costService;

    @GetMapping("select")
    public JsonResult select(CostQuery costQuery){
        List<CostVO> list = costService.select(costQuery);
        return JsonResult.ok(list);
    }

    @PostMapping("save")
    public JsonResult save(CostSaveParam costSaveParam ){
        costService.save(costSaveParam);
        return JsonResult.ok();
    }

}
